package com.tryon.repository;

import com.tryon.entity.PersonLibrary;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface PersonLibraryRepository extends JpaRepository<PersonLibrary, Long> {
    
    /**
     * 根据用户ID查询形象列表
     */
    List<PersonLibrary> findByUserIdAndIsDeletedOrderByIsDefaultDescCreatedAtDesc(Long userId, Integer isDeleted);
    
    /**
     * 根据用户ID查询默认形象
     */
    Optional<PersonLibrary> findByUserIdAndIsDefaultAndIsDeleted(Long userId, Integer isDefault, Integer isDeleted);
}

